from app import db


class PayOrder(db.Model):
    __tablename__ = 'pay_order'

    id = db.Column(db.Integer, primary_key=True)
    order_sn = db.Column(db.String(40), nullable=False, unique=True, comment='随机订单号')
    member_id = db.Column(db.BigInteger, nullable=False, comment='会员id')
    total_price = db.Column(db.Numeric(10, 2), nullable=False, comment='订单应付金额')
    yun_price = db.Column(db.Numeric(10, 2), nullable=False, comment='运费金额')
    pay_price = db.Column(db.Numeric(10, 2), nullable=False, comment='订单实付金额')
    pay_style = db.Column(db.Integer, nullable=False,server_default="1", default=1, comment='支付方式')  #1 微信 #2 支付宝
    note = db.Column(db.Text, nullable=False, comment='备注')
    status = db.Column(db.Integer, nullable=False, server_default="0", default=0, comment='订单状态：1 已完成 、0 待发货 、-2 订单取消中  -3 已取消')
    express_address = db.Column(db.String(100), nullable=False, comment='派送地址')
    pay_time = db.Column(db.DateTime, nullable=False, comment='支付时间')
    created_time = db.Column(db.DateTime, nullable=False, comment='插入时间')
